package com.baofu.trade.model;

import com.baofu.trade.model.indicator.*;
import lombok.Data;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;

@Data
public class PriceAnalysis {
    private BigDecimal currentPrice;
    private BigDecimal highestPrice;
    private BigDecimal lowestPrice;
    private FibonacciLevels fibonacciLevels;
    private List<EMAResult> emaResults;
    private BollingerBands bollingerBands;
    private String positionAnalysis;
    
    public Map<String, String> toMap() {
        Map<String, String> result = new LinkedHashMap<>();
        result.put("当前价格", currentPrice.setScale(2, RoundingMode.HALF_UP).toPlainString());
        
        // 添加斐波那契水平
        result.put("斐波那契0%(强支撑)", fibonacciLevels.getLevel0().toPlainString());
        result.put("斐波那契23.6%(支撑1)", fibonacciLevels.getLevel236().toPlainString());
        result.put("斐波那契38.2%(支撑2)", fibonacciLevels.getLevel382().toPlainString());
        result.put("斐波那契50%(关键支撑/阻力)", fibonacciLevels.getLevel500().toPlainString());
        result.put("斐波那契61.8%(阻力1)", fibonacciLevels.getLevel618().toPlainString());
        result.put("斐波那契78.6%(阻力2)", fibonacciLevels.getLevel786().toPlainString());
        result.put("斐波那契100%(强阻力)", fibonacciLevels.getLevel1000().toPlainString());
        
        // 添加EMA数据
        for (EMAResult ema : emaResults) {
            result.put("EMA" + ema.getPeriod() + "(" + ema.getDescription() + ")", 
                      ema.getValue().toPlainString());
        }
        
        // 添加布林带数据
        result.put("布林上轨(超买区)", bollingerBands.getUpper().toPlainString());
        result.put("布林中轨(趋势线)", bollingerBands.getMiddle().toPlainString());
        result.put("布林下轨(超卖区)", bollingerBands.getLower().toPlainString());
        
        // 添加高低点
        result.put("近期高点", highestPrice.setScale(2, RoundingMode.HALF_UP).toPlainString());
        result.put("近期低点", lowestPrice.setScale(2, RoundingMode.HALF_UP).toPlainString());
        
        // 添加位置分析
        result.put("位置分析", positionAnalysis);
        
        return result;
    }
} 